﻿using SharpSoft.WPF.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPF.DEMO.Pages
{
    /// <summary>
    /// TransitionPage.xaml 的交互逻辑
    /// </summary>
    public partial class TransitionPage : Page
    {
        public TransitionPage()
        {
            InitializeComponent();
            this.Loaded += TransitionPage_Loaded;
            cmb.SelectionChanged += Cmb_SelectionChanged;
        }

        private void Cmb_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cmb.SelectedValue is TransitionEffectType tet)
            {
                tec.TransitionEffectType = tet;
            }
        }

        private void TransitionPage_Loaded(object sender, RoutedEventArgs e)
        {
            var dic = EnumHelper.EnumAsDictionary<TransitionEffectType>();
            cmb.ItemsSource = dic;
            cmb.DisplayMemberPath = "Value";
            cmb.SelectedValuePath = "Key";
        }

        private void btn_tran_Click(object sender, RoutedEventArgs e)
        {
            tec.SnapshotAndStart();
            if (img1.Visibility == Visibility.Visible)
            {
                img1.Visibility = Visibility.Collapsed;
            }
            else
            {
                img1.Visibility = Visibility.Visible;
            }
        }
    }
}
